'''
eval(sorce,global=None,locals=None)
sorece:以字符串运行
'''
# x,y=1,2
# print(eval("x*y"))
#



'''
exec(sorce,global=None,locals=None)
sorce:做为程序运行
'''

# x=1
# y=2
# s="z=x+y;print(z);del z;print('删除');"
# exec(s)


# x,y,s = 1,2,"z=x+y;print(z)"
#
# exec(s)
# exec(s,{"x":10,"y":20})
# exec(s,{"x":10},{"x":100,"y":200})
# exec(s,{"x":10},{"y":200})


# 计算n**n
h = 5
num = sum(map(lambda n:n**n,range(1,h)))
print(num)


l=[]
for n in range(1,h):
    l.append(eval("n**n"))

print(sum(l))

# l2 = [4,3,2,1]
s = sum(map(lambda x,y:x**y,range(1,5),range(4,0,-1)))
print(s)



